import java.util.Scanner;

public class demo9 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String code = "123456";
        String password = "123456";
        int fallCount = 0;
        double money = 1200;

        while (true) {
            System.out.println("请输入银行卡号");
            String inputcode = input.next();
            System.out.println("请输入密码");
            String inputpassword = input.next();
            if (!code.equals(inputcode) || !password.equals(inputpassword)) {
                System.out.println("请重新输入");
                fallCount++;
            } else {
                break;
            }
            if (fallCount == 3) {
                break;
            }
        }
        while (true) {
            if (fallCount != 3) {
                System.out.println("******************************************************");
                System.out.println("*                                                    *");
                System.out.println(" *            欢迎使用中国工商银行ATM存取款机         *");
                System.out.println("******************************************************");
                System.out.println(" *    1、查看余额                       2、取款           *");
                System.out.println(" *    3、存款                          0、退出           *");
                System.out.println(" ******************************************************");
            }


                System.out.println("请输入您需要的服务");
                int index = input.nextInt();
                if (index == 1) {
                     System.out.println(money);
                } else if (index == 0) {
                     break;
                } else if (index == 2) {
                 System.out.println("请输入你要取出的金额");
                     double output= input.nextInt();
                     if(output>money){
                         System.out.println("余额不足");
                     }else {
                         System.out.println("取款成功");
                         money -= output;
                     }
                 } else if (index==3) {
                    System.out.println("请输入你要存款的金额");
                    double inputmoney=input.nextInt();
                    money+=inputmoney;
                 }
                else{
                    System.out.println("没有此选项");
                }


    }

}





        }









